{% extends "master.html" %}
{% block subtitle %} - 主面板 - 仓位管理 - 修改库存{% endblock %}

{% block extJS %}
<script language="JavaScript" type="text/javascript">
//<![CDATA[
    function toSbumit(){
        $(".error").removeClass("error");
        var flag = true;
        $(".num").each(function(){
            var t = $(this)
            if(!check_number(t.val())){
                flag = false;
                t.addClass('error');
            }
        })
        
        if(!flag){
            alert('{{MSG_NOT_ALL_PARAMS_OK}}');
            return false;
        }else{
            $("form").submit()
        }
        
    }
    
    function toCancel(){
        redirect_alert("{{MSG_LEAVE_WITHOUT_SAVING}}","{{url_for('bpIvt.view')}}")
    } 
//]]>
</script>
{% endblock %}

{% block main %}
<div class="container">
    <div class="row">
        <ol class="breadcrumb">
          <li><a href="{{url_for('bpRoot.view')}}">主面板</a></li>
          <li><a href="{{url_for('bpIvt.view')}}">仓位管理</a></li>
          <li class="active">修改库存</li>
        </ol>
    </div>
    <div class="row">
        <div class="btn-toolbar pull-right">
            <div class="btn-group"><button type="button" class="btn btn-primary" onclick="return toSbumit()">确认提交</button></div>
            <div class="btn-group"><button type="button" class="btn btn-inverse" onclick="return toCancel()">取消</button></div>
        </div>
    </div>
    <div class="row">
        <form method='post' action="{{url_for('.view',action='saveUpdateQty')}}" enctype="multipart/form-data">
        <table class="table table-bordered">
            <thead>
                <tr>
                    <th>商品名称</th>
                    <th>现存数量</th>
                    <th>修改后数量</th>
                </tr>
            </thead>
            <tbody>
                {% for (pdt,r) in result %}
                    <tr>
                        <td>{{pdt}}</td>
                        <td>{{r.qty}}</td>
                        <td><input type="text" name="qty_{{r.pdtID}}_{{r.ivtID}}" value="{{r.qty}}" class="num col-md-2"/></td>
                    </tr>
                {% endfor %}
            </tbody>                
        </table>
        </form>
    </div>
    
 
</div>
{% endblock %}